'''
例如方程(齐次)：
   x1+x2-x3-x4=0
   2x1-5x2+3x3+2x3=0
   7x1-7x2+3x3+x4=0
'''
import numpy as np
import sympy as sp
# 欠秩有无穷多解

# 欠秩最好用sympy
a=sp.Matrix([[1,1,-1,-1],[2,-5,3,2],[7,-7,3,1]])
b=sp.zeros(3,1)
x=sp.Symbol('x')
x0=sp.symarray(x,4).reshape(4,1)
res = sp.solve(a*x0-b)
# 解的方程
sp.pprint(res)
# 基础解系
sp.pprint(a.nullspace())
